<?php

/**
 * MontantVersement form base class.
 *
 * @method MontantVersement getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMontantVersementForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'type'                => new sfWidgetFormInputCheckbox(),
      'montant'             => new sfWidgetFormInputText(),
      'date'                => new sfWidgetFormDate(),
      'id_versement_caisse' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('VersementCaisse'), 'add_empty' => false)),
      'reference_piece'     => new sfWidgetFormInputText(),
      'date_echeance'       => new sfWidgetFormDate(),
      'banque'              => new sfWidgetFormInputText(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'type'                => new sfValidatorBoolean(),
      'montant'             => new sfValidatorNumber(),
      'date'                => new sfValidatorDate(),
      'id_versement_caisse' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('VersementCaisse'))),
      'reference_piece'     => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'date_echeance'       => new sfValidatorDate(),
      'banque'              => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('montant_versement[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MontantVersement';
  }

}
